// 判断是否是excel文件
export const isExcelFile = (result) => {
  console.log("[ result ] >", result);
  return result.headers["content-type"].includes("ms-excel");
};

// 导出excel
export const exportExcel = (data, fileName) => {
  const blob = new Blob([data.data], {
    type: data.headers["content-type"],
  });
  console.log("[ blob ] >", blob);
  const url = window.URL.createObjectURL(blob);
  const a = document.createElement("a");
  a.href = url;
  a.download = data.headers["content-disposition"];
  a.click();
};
